<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">

</script>
<style type="text/css">

.comment_box
{
background-color:#D3E7F5; border-bottom:#ffffff solid 1px; padding-top:3px
}

</style>

<?php
	include_once("dataprovider.php");
	$ma = $_POST['ma'] ;
	
	$sql = "SELECT ten,loai,hinh,mota,gia,soluong FROM sanpham where ma=$ma";
		
	$result = DataProvider::ExecuteQuery($sql);
		
	$row = mysql_fetch_assoc($result);

?>
<table>
	<tr>
		<td><strong>Sản Phẩm:</strong><?php echo($row['ten']);?></td>
	</tr>
	<tr>
		<td><strong>Giá:</strong> <?php echo($row['gia']." Triệu");?></td>
	</tr>
	<tr>
		<td><strong>Số Lượng</strong> <?php echo($row['soluong']." Bộ");?></td>
	</tr>
	<tr>
		<td><strong>Mô Tả:</strong> <?php echo($row['mota']);?></td>
	</tr>
	<tr>
		<td>
			<img src="<?php echo($row['hinh']);?>" alt="" width="100%" height="100%" />
		</td>
	</tr>
	
</table>

<table>
	<tr>
		<td>
			<strong>Bài Bình Luận</strong>
		</td>
	</tr>
	<?php
$sql = "SELECT email, noidung FROM binnhluan where sanpham=$ma";
		
	$result = DataProvider::ExecuteQuery($sql);
	$flag = 0;	
	while($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
		
		$flag = 1;

	
?>
	<tr>
		<td class="comment_box" width="500">
			<strong><?php echo($row['email']);?></strong><br />
			<?php echo($row['noidung']);?>
			
		</td>
	</tr>
<?php
	}
	if($flag==0)
	{
?>
	<tr>
		<td>
<?php
			 echo("<strong>chưa có bình luận nào cho sản phẩm này!</strong>");
	}
?>
		</td>
	</tr>
	<div id="binluanmoi" class="comment_box" width="500"></div>
</table>
<form name="fbinhluan">
<table>
	<tr>
		<td>
			<label>Họ Tên: </label>
			<input type="text" id="txtNguoiBL"  />
		</td>
	</tr>
	
	<tr>
		<td>
	<textarea  cols="45" rows="5"  id="noidung"></textarea><br />
	
	</td>
	
	</tr>
	<tr>
		<td>
	
	<input type="button" name="btnDang" id="btnDang" value="Đăng"  onclick="comment(<?php echo($ma);?>)"/>
		</td>
	
	</tr>
</table>
</form>
